package com.chap13;

import com.chap13.util.Utils;

import java.util.Arrays;
import java.util.concurrent.ForkJoinPool;

/**
 * <p>
 * <code>Test2</code>
 * </p>
 *
 * @author junbao3
 * TODO
 * @date 2023-04-12 9:22
 * Copyright (C) 2021 IFlyTek. All rights reserved.
 */
public class Test2 {
    public static void main(String[] args) {
        int[] arrayToSortByMergeSort = {6,5,3,1,8,7,2,4};
        int processors = Runtime.getRuntime().availableProcessors();
        MergeSortTask task = new MergeSortTask(arrayToSortByMergeSort,processors);
        ForkJoinPool forkJoinPool = new ForkJoinPool(processors);
        forkJoinPool.invoke(task);
        System.out.println(Arrays.toString(task.getOrignArray()));
    }
}
